import types from "../action-types"


export interface IUserState {
    isLoading: boolean
    menuInfo: any
}


const initState: IUserState = {
    isLoading: false,
    menuInfo: {}
};


export default (state = initState, action: any) => {

    switch (action.type) {
        case types.START_LOGGED_ROUTE:
            return {
                ...state,
                isLoading: true,

            };
        case types.SUCCESS_LOGGED_ROUTE:
            return {
                ...state,
                ...action.payload.menuInfo,
                isLoading: false,
            };
        case types.FAILED_LOGGED_ROUTE:
            return {
                ...state,
                isLoading: false,
            };
        default:
            return state;

    }

}
